function Uploader() {
  var self = this;
  
  this.enableUpload=function(jElement) {
    jElement.fileupload({
      'dropZone':jElement,
      'dataType':'json',
      'url':'lib/ajax.php?action=upload',
      'add':function(e, data) {
        var jThis = $(this);
        jThis.fileupload('option', 'formData', {'destdir':jThis.find('[showspath]').attr('showspath')});
        $('#uploadfeedback').css('display', 'block');
        data.submit();
      },
      'done':function(e, data) {
        addMessage(data.result['code']==0, data.result['melding']);
      },
      'fail':function(e, data) {
        addMessage(true, data.errorThrown);
      }
    });
  }
  
  function addMessage(bError, sMessage) {
    $('#donemessages').append('<span style="color:'+(bError?'red':'black')+'">'+sMessage+'</span><br />');
  }
  
  this.init=function() {
    rAll=document.documentElement;
    iAvailHeight=rAll.offsetHeight;
    iAvailWidth=rAll.offsetWidth;
    
    $('#uploadfeedback').css({
         top:Math.floor(iAvailHeight / 5) + 'px',
        left:Math.floor(iAvailWidth  / 5) + 'px',
       width:Math.floor(iAvailWidth  / 2) + 'px',
      height:Math.floor(iAvailHeight / 2) + 'px'
    });
    $('#uploadfeedback #sluit').click(function() {
      $('#uploadfeedback').css('display', 'none');
    });
  }
}
